Pwait3(2) Oct. 1, 1991 Pwait3(2) NAME Pwait, Pwait3 - get exit status of children SYNOPSIS LONG Pwait(); LONG Pwait3( WORD flag, LONG *rusage ); DESCRIPTION Pwait3 attempts to determine the exit code for any stopped children or children that have terminated. If bit 1 of flag is set, then children that are stopped due to job control are reported; otherwise only children that have actually terminated are reported. A stopped process will be reported at most once (unless it is re-started and stopped again); similarly a terminated process will be reported only once. If the process does have children, but none are currently stopped or terminated and not yet waited for, then the behavior of Pwait3 is controlled by bit 0 of flag. If it is clear, the function will wait until some child is stopped or terminates; if it is set, the function will return immedi- ately. The rusage parameter, if non-zero, should point to two long words, into which information about the child's CPU time usage is placed, as follows: rusage[0]: milliseconds spent by child in user space rusage[1]: milliseconds spent by child in kernel space The Pwait() system call is equivalent to Pwait3(2, (LONG *)0), and is provided both for convenience and for backward compatibility. RETURNS If a child process is found, its process id is placed in the upper 16 bits of the 32 bit value returned, and its exit status (as passed to Pterm or Ptermres, as determined impli- citly by Pterm0, or as determined by the type of signal that stopped or killed the process) is placed in the lower 16 bits. If the process was stopped or terminated by signal n, then its exit status will be ( n<< 8 ) | x. where x is 127 if the process was stopped and 0 if the process was ter- minated. 0 if bit 0 of flag is set and the Pwait3 system call would have otherwise blocked waiting for a child to exit or stop. EFILNF if no unwaited for children exist SEE ALSO Pexec(2), Pterm(2), Pterm0(2), Ptermres(2) Version 0.9 Last change: MiNT Programmer's Manual 1 Pwait3(2) Oct. 1, 1991 Pwait3(2) BUGS It is not possible to wait for a specific child process. Version 0.9 Last change: MiNT Programmer's Manual 2